# Maintainer: Andreas Radke <andyrtr@archlinux.org>
# Contributor: WorMzy Tykashi <wormzy.tykashi@gmail.com>

pkgname=lprint
pkgver=1.2.0
pkgrel=1
pkgdesc="Label Printer Application"
arch=('loong64' 'x86_64')
url="https://www.msweet.org/lprint/"
license=('Apache' 'custom')
depends=('pappl' 'libcups' 'libpng' 'libusb' 'pam')
options=('debug')
source=("https://github.com/michaelrsweet/lprint/releases/download/v${pkgver}/${pkgname}-${pkgver}.tar.gz"{,.sig})
validpgpkeys=('845464660B686AAB36540B6F999559A027815955')  # "Michael R Sweet <michael.r.sweet@gmail.com>"
#validpgpkeys=('9086C3CDC66C3F563CF8F405BE67C75EC81F3244') # "Michael R Sweet <msweet@msweet.org>"
sha256sums=('96a2f7efbbd318cc7189c4b1d59894caee02503a881a82d7a212d2a94636f95c'
            'SKIP')

build() {
  cd ${pkgname}-${pkgver}
  ./configure --prefix=/usr --with-systemd
  make
}

check() {
   cd "$pkgname-$pkgver"
#   make -k check
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
  # add license + exception
  install -m644 -Dt "${pkgdir}/usr/share/licenses/${pkgname}" {LICENSE,NOTICE}

  # workaround until next release - FS#75465 / https://github.com/michaelrsweet/lprint/pull/63
  sed -i "s:/local::" "${pkgdir}"/usr/lib/systemd/system/lprint.service
}
